-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix memory leak with Coordinate::_lockFunction. #510
Conversation
@sherm1 says:
std::unique_ptr<Function> func(new Function()); // func has ownership
ReferencePtr<Function> funcref(func.get()); // keep a reference to Function object
Constraint::PrescribedMotion(func.release()); // take over ownership from func |
To reviewers: please don't merge this until the above change is made. Also, feel free to make the above change for me! |
…into coordinate-lock-function-leak
Made reference pointer const rather than mutable, like the indices.
OK, I did. Please review. |
Hmm. AppVeyor build died immediately; related to this morning's AppVeyor update? Chris, please see separate email. |
Added a commit to allow "deprecated-declaration" warnings to occur without error until we fix issue #528. |
I'm merging this now because it fixes the CI builds. |
Fix memory leak with Coordinate::_lockFunction.
Okay; @aseth1 definitely should look at these changes at some point. |
Thanks for doing this @sherm1 . |
I added a comment to the code to describe why I made this change:
By putting the allocation right next to the creation of the related PrescribedMotion, we should be able to avoid the leak.
I detected the leak in the process of trying to get
testInitState
to pass on OSX. I detected the leak with valgrind and also used valgrind to verify that the leak is now gone.